package com.zdky.tpl.queue;

import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.concurrent.CountDownLatch;

@Component
@Slf4j
public class ConsumerFor4Hours {
    protected Logger logger = LoggerFactory.getLogger(this.getClass());
    
    @Autowired
    private CountDownLatch countDownLatch;

    @Autowired
    private ConsumerProcessor consumerProcessor;
    
    
    /**
     * 监听队列消息，方法名称请勿修改
     * @param msg
     */
    public void receivedMsg(String msg) {
        logger.info("ConsumerFor4Hours.receivedMsg 接收到了消息："+msg);
        consumerProcessor.core(msg);
       //  计数，减一
        countDownLatch.countDown();
    }

}